<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <UEditor :initData="description" ref="ueditor"></UEditor>
  </div>
</template>

<script>
import UEditor from '../../components/ueditor.vue'
export default {
  name: 'product',
  components: { UEditor },
  data () {
    return {
      msg: 'Welcome to Your Vue.js App 商品列表'
    }
  },
  mounted () {
    this.allList()
    let date = new Date()
    let year = date.getFullYear()
    let month = date.getMonth() + 1 >= 10 ? date.getMonth() : `0${(date.getMonth() + 1)}`
    let day = date.getDate() >= 10 ? date.getDate() : `0${date.getDate()}`
    let hh = date.getHours() >= 10 ? date.getHours() : `0${date.getHours()}`
    let mm = date.getMinutes() >= 10 ? date.getMinutes() : `0${date.getMinutes()}`
    let ss = date.getSeconds() >= 10 ? date.getSeconds() : `0${date.getSeconds()}`
    let time = year + month + day + hh + mm + ss
    console.log(time) // 20190215180840
  },
  methods: {
    allList () {
      let data = '盗墓笔记'
      this.$http.get(`/novelSearchApi?name=${data}`).then((res) => {
        console.log(res)
      })
    },
    // 禁止移动端页面滑动
    stopPageSlip () {
      let fn = function (e) {
        e.preventDefault()
        e.stopPropagation()
      }
      document.body.addEventListener('touchmove', fn, { passive: false })
    },
    // 取消禁止移动端页面滑动
    cancelStopPageSlip () {
      let fn = function (e) {
        e.preventDefault()
        e.stopPropagation()
      }
      document.body.removeEventListener('touchmove', fn, { passive: false })
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1 {
  font-weight: normal;
}
</style>
